import request from '../utils/request'
// 封装获取文章详情的API
export const getArticleDetailAPI = (id) => {
  return request.get(`/v1_0/articles/${id}`)
}

// 封装关注作者的API
export const folloWingsAPI = (artId) => {
  return request.post('/v1_0/user/followings', { target: artId })
}

// 封装取关作者的API
export const unfollowUserAPI = (artId) => {
  return request.delete(`/v1_0/user/followings/${artId}`)
}

// 封装点赞文章API
export const addLikeAPI = (audId) => {
  return request.post('/v1_0/article/likings', { target: audId })
}

// 封装取消点赞API
export const delLikeAPI = (audId) => {
  return request.delete(`/v1_0/article/likings/${audId}`)
}

// 封装获取文章详情API
export const getCmtListAPI = (artId, offset) => {
  return request.get('/v1_0/comments', { params: { type: 'a', source: artId, offset } })
}

// 封装点赞评论API
export const addLikeCmtAPI = (commentId) => {
  return request.post('/v1_0/comment/likings', { target: commentId })
}

// 封装取消点赞API
export const delLikeCmtAPI = (commentId) => {
  return request.delete(`/v1_0/comment/likings/${commentId}`)
}

// 封装发表评论的API
export const pubCommentAPI = (artId, content) => {
  return request.post('/v1_0/comments', { target: artId, content })
}
